package com.ptswitch.material.web.action;

import java.util.List;

import org.springframework.stereotype.Controller;

import com.ptswitch.material.model.HLog;

@Controller("hlogAction")
public class HLogAction extends ActionSupport{

	private String like;
	private List logs;
	private HLog log;

	// display
	public String display() {
		mustLogin();
		log = hlogSer.get(id);
		return "display";
	}

	public String all() {
		mustLogin();
		logs = hlogSer.getAll(page.getCurrentRow(), page.getPageSize());
		page.setRowCount(hlogSer.countAll());
		return "list";
	}

	// delete
	public String delete() {
		mustAdmins();
		hlogSer.delete(hlogSer.get(id));
		return "rList";
	}

	public String deleteAll() {
		mustAdmins();
		hlogSer.deleteAll();
		return "rList";
	}

	// other
	public String like() {
		logs = hlogSer.getLike(like, page.getCurrentRow(), page.getPageSize());
		page.setRowCount(hlogSer.countLike(like));
		return "list";
	}

	// get and set
	public String getLike() {
		return like;
	}

	public void setLike(String like) {
		this.like = like;
	}

	public List getLogs() {
		return logs;
	}

	public HLog getLog() {
		return log;
	}

}
